<html>
<head>
    <title>运维管理</title>
    <link rel="stylesheet" href="../../../assets/theme-chalk/index.css">
    <link rel="stylesheet" href="../../../style.css">
    <link rel="stylesheet" href="../../../swipebox.css">
    <style>
        body {
            background: #F2F2F2;
        }

        .main-head {
            background: #fff;
            padding-left: 10px;
            padding-top: 10px;
            margin-bottom: 0px;
            border: solid 1px #fff;
        }

        .chart-outer {
            height: 200px;
        }

        .page-top {
            margin: 30px 0 0px 30px;

        }
    </style>
</head>
<body>
<div class="page" id="page-elesafe">

    <div class="page-title">预警隐患处理,预警隐患台账</div>
    <div class="page-main">
        <el-row>
            <el-col :span="24" style="    background: #ffffff;">
                <el-form :inline="true" class="page-top">
                    <el-form-item>
                        <el-select v-model="param.wf_objType" placeholder="工单类型" style="width: 120px;">
                            <el-option label="告警" value="5"></el-option>
                            <el-option label="随手拍" value="7"></el-option>
                            <el-option label="整改" value="8"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item>
                        <el-select v-model="param.wf_processflag" placeholder="工单状态" style="width: 120px;">
                            <el-option label="未处理" value="0"></el-option>
                            <el-option label="处理" value="2"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item>
                        <el-date-picker v-model="day" type="month" placeholder="选择月" style="width: 140px;">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item>
                        <el-select v-model="param.todays" placeholder="选择日" style="width: 120px;">
                            <el-option label="请选择" value=""></el-option>
                            <el-option label="1日" value="1"></el-option>
                            <el-option label="2日" value="2"></el-option>
                            <el-option label="3日" value="3"></el-option>
                            <el-option label="4日" value="4"></el-option>
                            <el-option label="5日" value="5"></el-option>
                            <el-option label="6日" value="6"></el-option>
                            <el-option label="7日" value="7"></el-option>
                            <el-option label="8日" value="8"></el-option>
                            <el-option label="9日" value="9"></el-option>
                            <el-option label="10日" value="10"></el-option>
                            <el-option label="11日" value="11"></el-option>
                            <el-option label="12日" value="12"></el-option>
                            <el-option label="13日" value="13"></el-option>
                            <el-option label="14日" value="14"></el-option>
                            <el-option label="15日" value="15"></el-option>
                            <el-option label="16日" value="16"></el-option>
                            <el-option label="17日" value="17"></el-option>
                            <el-option label="18日" value="18"></el-option>
                            <el-option label="19日" value="19"></el-option>
                            <el-option label="20日" value="20"></el-option>
                            <el-option label="21日" value="21"></el-option>
                            <el-option label="22日" value="22"></el-option>
                            <el-option label="23日" value="23"></el-option>
                            <el-option label="24日" value="24"></el-option>
                            <el-option label="25日" value="25"></el-option>
                            <el-option label="26日" value="26"></el-option>
                            <el-option label="27日" value="27"></el-option>
                            <el-option label="28日" value="28"></el-option>
                            <el-option label="29日" value="29"></el-option>
                            <el-option label="30日" value="30"></el-option>
                            <el-option label="31日" value="31"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item>
                        <el-button @click="seoBtn" type="primary">查询</el-button>
                        <el-button @click="exportData" type="primary">导出</el-button>
                    </el-form-item>
                </el-form>
                <el-table border stripe style="width: 100%;margin-bottom: 50px" :data="tabData">
                    <el-table-column prop="wf_eventName" label="工单名称" align="center">
                    </el-table-column>
                    <el-table-column prop="wf_objType" label="工单类型" align="center">
                        <template slot-scope="scope">
                            <div v-if="scope.row.wf_objType == '5'">
                                <el-tag size="medium" type="success">告警</el-tag>
                            </div>
                            <div v-else-if="scope.row.wf_objType == '7'">
                                <el-tag size="medium" type="success">随手拍</el-tag>
                            </div>
                            <div v-else-if="scope.row.wf_objType == '8'">
                                <el-tag size="medium" type="success">整改</el-tag>
                            </div>
                        </template>
                    </el-table-column>
                    <el-table-column prop="fromName" label="工单发出人" align="center">
                    </el-table-column>
                    <el-table-column prop="toName" label="工单接收人" align="center">
                    </el-table-column>
                    <el-table-column prop="wf_tasktime" label="派单时间" align="center">
                        <template slot-scope="scope" v-if="scope.row.wf_tasktime">
                            <el-tag size="medium">{{scope.row.wf_tasktime.replace("T"," ")}}</el-tag>
                        </template>
                    </el-table-column>
                    <el-table-column prop="wf_eventMsg" label="隐患内容" align="center">
                    </el-table-column>
                    <el-table-column label="隐患图片">
                        <template slot-scope="scope">
                            <template v-if="scope.row.wf_objType==7&&scope.row.handImg">
                                <!--                                <a :href="imageUrl+scope.row.handImg" class="swipebox" title="ESC键退出">-->
                                <el-popover
                                        placement="right"
                                        width="300"
                                        trigger="hover"
                                        popper-class="popClass">
                                    <img :src="scope.row.handImg"
                                         style="max-width:600px;max-height: 380px "/>
                                    <img :src="scope.row.handImg" slot="reference"
                                         style="max-width:80px;max-height: 80px "/>
                                </el-popover>
                                <!--                                </a>-->
                            </template>
                            <template v-if="scope.row.wf_objType==8&&scope.row.image1">
                                <!--                                <a :href="imageUrl+scope.row.image1" class="swipebox" title="ESC键退出">-->
                                <el-popover
                                        placement="right"
                                        width="300"
                                        trigger="hover"
                                        popper-class="popClass">
                                    <img :src="scope.row.image1"
                                         style="max-width:600px;max-height: 380px "/>
                                    <img :src="scope.row.image1" slot="reference"
                                         style="max-width:80px;max-height: 80px "/>
                                </el-popover>
                                <!--                                </a>-->
                            </template>
                        </template>
                    </el-table-column>
                    <el-table-column prop="urgentCount" label="催办次数" align="center">
                    </el-table-column>
                    <el-table-column prop="wf_processflag" label="工单处理状态" align="center">
                        <template slot-scope="scope">
                            <div v-if="scope.row.wf_processflag == '2'">
                                <el-tag size="medium" type="success">已处理</el-tag>
                            </div>
                            <div v-else-if="scope.row.wf_processflag == '0'">
                                <el-tag size="medium" type="success">未处理</el-tag>
                            </div>
                        </template>
                    </el-table-column>
                    <el-table-column prop="wf_processflag" label="工单生效状态" align="center">
                        <template slot-scope="scope">
                            <div v-if="scope.row.effectiveFlag == '0'">
                                <el-tag size="medium" type="success">生效</el-tag>
                            </div>
                            <div v-else-if="scope.row.effectiveFlag == '1'">
                                <el-tag size="medium" type="warning">未生效</el-tag>
                            </div>
                        </template>
                    </el-table-column>
                    <el-table-column prop="wf_processtime" label="完成时间" align="center">
                        <template slot-scope="scope" v-if="scope.row.wf_processtime">
                            <el-tag size="medium">{{scope.row.wf_processtime.replace("T"," ")}}</el-tag>
                        </template>
                    </el-table-column>
                    <el-table-column label="操作" width="500px" align="center">
                        <template slot-scope="scope">
                            <!--<el-button @click="handleClick(scope.row)" round size="mini" icon="el-icon-edit"-->
                            <!--v-if="scope.row.wf_processflag == '0'">处理-->
                            <!--</el-button>-->
                            <el-button @click="showDetail(scope.$index,scope.row)" round size="mini" icon="el-icon-share"
                                       v-if="scope.row.wf_processflag == '2'">明细
                            </el-button>
                            <el-button round size="mini" icon="el-icon-share"
                                       @click="urgent(scope.row.Id,scope.row.wf_tasktime,scope.row.urgentCount)">催办
                                <!--                                <template slot-scope="scope" >-->
                                <!--                                    ({{scope.row.urgentCount}})-->
                                <!--                                </template>-->
                            </el-button>

                            <template v-if="scope.row.effectiveFlag==0">
                                <el-button round size="mini" icon="el-icon-share"
                                           @click="effective(scope.row.Id,1,scope.row.wf_tasktime,scope.row.wf_processflag)">
                                    不生效
                                </el-button>
                            </template>
                            <template v-if="scope.row.effectiveFlag==1">
                                <el-button round size="mini" icon="el-icon-share"
                                           @click="effective(scope.row.Id,0,scope.row.wf_tasktime,scope.row.wf_processflag)">
                                    生效
                                </el-button>
                            </template>

                            <template v-if="scope.row.assessFlag==-1">
                                <el-button round size="mini" icon="el-icon-share"
                                           @click="openAssess(scope.row.Id,scope.row.wf_tasktime,scope.row.wf_processflag)">
                                    验收
                                </el-button>
                            </template>
                            <template v-else>
                                <el-button round size="mini" icon="el-icon-share" @click="openAssessed(scope.row)">
                                    已验
                                </el-button>
                            </template>
                            <el-button round size="mini" icon="el-icon-share"
                                       @click="checkdata(scope.row.Id,scope.row.wf_tasktime)">转派记录
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-col>
        </el-row>

        <el-dialog title="工单处理" :visible.sync="dialogFormVisible" :show-close="false" style="display: none">
            <el-form :model="form">
                <el-col :span="12">
                    <el-form-item label="工单名称" :label-width="formLabelWidth">
                        <el-input v-model="form.wf_eventName" autocomplete="off" :disabled="true"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="工单类型" :label-width="formLabelWidth">
                        <el-input v-model="form.wf_objType" autocomplete="off" :disabled="true"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="工单发出人" :label-width="formLabelWidth">
                        <el-input v-model="form.fromName" autocomplete="off" :disabled="true"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="工单接收人" :label-width="formLabelWidth">
                        <el-input v-model="form.toName" autocomplete="off" :disabled="true"></el-input>
                    </el-form-item>
                </el-col>
                <el-form-item label="隐患内容" :label-width="formLabelWidth">
                    <el-input v-model="form.wf_eventMsg" autocomplete="off" :disabled="true"></el-input>
                </el-form-item>
                <el-form-item label="原因分析" :label-width="formLabelWidth">

                    <el-input v-model="form.wf_processmsg" autocomplete="off"></el-input>

                </el-form-item>

                <el-form-item label="处理过程" :label-width="formLabelWidth">
                    <el-input v-model="form.wf_reason" autocomplete="off"></el-input>
                </el-form-item>
                <el-form-item label="图片上传" :label-width="formLabelWidth">
                    <el-upload
                            class="upload-demo"
                            drag
                            ref="upload"
                            action="http://iot.hzcando.com/api/idm/v1/process"
                            :auto-upload="false"
                            :headers="headers"
                            name="img"
                            :data="uploadData"
                            limit="1">
                        <i class="el-icon-upload"></i>
                        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
                        <div class="el-upload__tip" slot="tip">只能上传一张jpg/png文件，</div>
                    </el-upload>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="dialogFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="submitClick">确 定</el-button>
            </div>
        </el-dialog>
        <el-dialog title="处理明细" :visible.sync="detailFormVisible" :show-close="false" style="display: none">
            <h1 align="right">
                <el-button @click="exportDoc" type="success">导出word</el-button>
            </h1>
            <template v-if="form">
                <table border="1" cellpadding="10" cellspacing="0" style="width: 100%;margin-top: 20px">
                    <tr>
                        <td style="font-weight: bold">工单名称:</td>
                        <td> {{form.wf_eventName}}</td>
                        <td style="font-weight: bold">工单类型:</td>
                        <td>
                            <div v-if="form.wf_objType == '5'">
                                告警
                            </div>
                            <div v-else-if="form.wf_objType == '7'">
                                随手拍
                            </div>
                            <div v-else-if="form.wf_objType  == '8'">
                                整改
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td style="font-weight: bold">工单发出人:</td>
                        <td>{{form.fromName}}</td>
                        <td style="font-weight: bold">工单接收人:</td>
                        <td>{{form.toName}}</td>
                    </tr>

                    <tr>
                        <td style="font-weight: bold">隐患内容:</td>
                        <td colspan="3">{{form.wf_eventMsg}}</td>
                    </tr>
                    <tr>
                        <td style="font-weight: bold">原因分析:</td>
                        <td colspan="3">{{form.wf_reason}}
                        <td>
                    </tr>
                    <tr>
                        <td style="font-weight: bold">处理过程:</td>
                        <td colspan="3">{{form.wf_processmsg}}
                        <td>
                    </tr>
                    <tr>
                        <td style="font-weight: bold">隐患处理前图片:</td>
                        <td colspan="3">
                            <template v-if="form.wf_objType==7&&form.handImg">
                                <el-popover
                                        placement="right"
                                        width="300"
                                        trigger="hover"
                                        popper-class="popClass">
                                    <img :src="form.handImg"
                                         style="max-width:600px;max-height: 380px "/>
                                    <img :src="form.handImg" slot="reference"
                                         style="max-width:80px;max-height: 80px "/>
                                </el-popover>

                                <!--<el-image :src="form.handImg" style="width: 80%; height: 120px" fit="contain">-->
                                <!--</el-image>-->
                            </template>
                            <template v-if="form.wf_objType==8&&form.image1">
                                <el-popover
                                        placement="right"
                                        width="300"
                                        trigger="hover"
                                        popper-class="popClass">
                                    <img :src="form.image1"
                                         style="max-width:600px;max-height: 380px "/>
                                    <img :src="form.image1" slot="reference"
                                         style="max-width:80px;max-height: 80px "/>
                                </el-popover>

                                <!--<el-image :src="form.image1" style="width: 80%; height: 120px" fit="contain">-->
                                <!--</el-image>-->
                            </template>
                        <td>
                    </tr>

                    <tr>
                        <td style="font-weight: bold">隐患处理后图片:</td>
                        <td colspan="3">
                            <el-popover
                                    placement="right"
                                    width="300"
                                    trigger="hover"
                                    popper-class="popClass">
                                <img :src="form.img"
                                     style="max-width:600px;max-height: 380px "/>
                                <img :src="form.img" slot="reference"
                                     style="max-width:80px;max-height: 80px "/>
                            </el-popover>
                            <!--<el-image :src="form.img" style="width: 80%; height: 120px" fit="contain">-->
                            <!--</el-image>-->
                        <td>
                    </tr>
                </table>


                <!--<el-form :model="form">-->
                <!--<el-col :span="12">-->
                <!--<el-form-item label="工单名称:" :label-width="formLabelWidth">-->
                <!--{{form.wf_eventName}}-->
                <!--&lt;!&ndash;                        <el-input v-model="form.wf_eventName" autocomplete="off"></el-input>&ndash;&gt;-->
                <!--</el-form-item>-->
                <!--</el-col>-->
                <!--<el-col :span="12">-->
                <!--<el-form-item label="工单类型:" :label-width="formLabelWidth">-->
                <!--<div v-if="form.wf_objType == '5'">-->
                <!--告警-->
                <!--</div>-->
                <!--<div v-else-if="form.wf_objType == '7'">-->
                <!--维修-->
                <!--</div>-->
                <!--<div v-else-if="form.wf_objType  == '8'">-->
                <!--整改-->
                <!--</div>-->
                <!--&lt;!&ndash;                        <el-input v-model="form.wf_objType" autocomplete="off"></el-input>&ndash;&gt;-->
                <!--</el-form-item>-->
                <!--</el-col>-->
                <!--<el-col :span="12">-->
                <!--<el-form-item label="工单发出人:" :label-width="formLabelWidth">-->
                <!--{{form.fromName}}-->
                <!--&lt;!&ndash;                        <el-input v-model="form.fromName" autocomplete="off"></el-input>&ndash;&gt;-->
                <!--</el-form-item>-->
                <!--</el-col>-->
                <!--<el-col :span="12">-->
                <!--<el-form-item label="工单接收人:" :label-width="formLabelWidth">-->
                <!--{{form.toName}}-->
                <!--&lt;!&ndash;                        <el-input v-model="form.toName" autocomplete="off"></el-input>&ndash;&gt;-->
                <!--</el-form-item>-->
                <!--</el-col>-->
                <!--<el-form-item label="隐患内容:" :label-width="formLabelWidth">-->
                <!--{{form.wf_eventMsg}}-->
                <!--</el-form-item>-->
                <!--<el-form-item label="原因分析:" :label-width="formLabelWidth">-->
                <!--{{form.wf_reason}}-->
                <!--&lt;!&ndash;                    <el-input v-model="form.wf_processmsg" autocomplete="off" disabled></el-input>&ndash;&gt;-->

                <!--</el-form-item>-->

                <!--<el-form-item label="处理过程:" :label-width="formLabelWidth">-->
                <!--{{form.wf_processmsg}}-->
                <!--&lt;!&ndash;                    <el-input v-model="form.wf_reason" autocomplete="off" disabled></el-input>&ndash;&gt;-->
                <!--</el-form-item>-->

                <!--<el-form-item label="隐患处理前图片:" :label-width="formLabelWidth">-->
                <!--<template v-if="form.wf_objType==7&&form.handImg">-->
                <!--<el-image :src="form.handImg" style="width: 80%; height: 120px" fit="contain">-->
                <!--</el-image>-->
                <!--</template>-->
                <!--<template v-if="form.wf_objType==8&&form.image1">-->
                <!--<el-image :src="form.image1" style="width: 80%; height: 120px" fit="contain">-->
                <!--</el-image>-->
                <!--</template>-->
                <!--</el-form-item>-->
                <!--<el-form-item label="隐患处理后图片:" :label-width="formLabelWidth">-->
                <!--<el-image :src="form.img" style="width: 80%; height: 120px" fit="contain">-->
                <!--</el-image>-->
                <!--</el-form-item>-->
                <!--</el-form>-->
            </template>
            <div slot="footer" class="dialog-footer">
                <el-button @click="cancelDetail">确定</el-button>
            </div>
        </el-dialog>
        <el-dialog title="验收明细" :visible.sync="assessedFormVisible" :show-close="false" style="display: none">
            <el-form :model="Assessed">
                <template v-if="Assessed.assess">
                    <el-form-item label="验收内容:" :label-width="formLabelWidth">
                        {{Assessed.assess}}
                        <!--                    <el-input v-model="form.wf_reason" autocomplete="off" disabled></el-input>-->
                    </el-form-item>
                    <el-form-item label="验收类型:" :label-width="formLabelWidth">
                        {{Assessed.assessFlag==0?'不合格':'合格'}}
                    </el-form-item>
                    <el-form-item label="验收时间:" :label-width="formLabelWidth">
                        <templeate v-if="Assessed.assessTime">
                            {{Assessed.assessTime.replace("T"," ")}}
                        </templeate>
                    </el-form-item>
                </template>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="assessedFormVisible=false">确定</el-button>
            </div>
        </el-dialog>
        <el-dialog title="验收" :visible.sync="assessFormVisible" :show-close="false" style="display: none">
            <el-form :model="Assess">
                <el-form-item label="验收结论" :label-width="formLabelWidth">
                    <el-input v-model="Assess.assess" autocomplete="off" type="textarea"></el-input>
                </el-form-item>
                <el-form-item label="验收结果" :label-width="formLabelWidth">
                    <el-radio v-model="Assess.assessFlag" label="0">不合格</el-radio>
                    <el-radio v-model="Assess.assessFlag" label="1">合格</el-radio>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="assessFormVisible = false">取 消</el-button>
                <el-button @click="insertAssess">确定</el-button>
            </div>
        </el-dialog>

        <el-dialog :title="'转派记录'" :visible.sync="dialogcheckdataVisible" style="display: none">
            <el-table :data="checkDatalist" height="360" :stripe="true" :border="true" size="mini" style="width: 100%">
                <el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
                <el-table-column prop="wf_eventName" label="工单名称"></el-table-column>
                <el-table-column prop="cover_name" label="被转派人"></el-table-column>
                <el-table-column prop="turn_name" label="转派人"></el-table-column>
                <el-table-column prop="createtime" label="转派时间">
                    <template slot-scope="scope">
                        <el-tag size="medium">{{scope.row.createtime.replace("T"," ")}}</el-tag>
                    </template>
                </el-table-column>
                <el-table-column prop="note" label="备注"></el-table-column>
            </el-table>
            <div class="page-footer">
                <el-pagination background layout="prev, pager, next" :pagesize="checkpagesize" :total="checktotalCount"
                               :current-page.sync="checkpageno" @current-change="onCheckChangePage">
                </el-pagination>
            </div>
        </el-dialog>
    </div>
    <div class="page-footer">
        <el-pagination background layout="prev, pager, next" :pagesize="param.pagesize" :total="totalCount"
                       :current-page.sync="param.pageno" @current-change="onChangePage">
        </el-pagination>
    </div>
</div>


<!-- import Vue before Element -->
<script src="../../../assets/bundle.js"></script>
<!-- import JavaScript -->
<script type='text/javascript' src='../../../assets/bundle.js' charset='utf-8'></script>
<script type='text/javascript' src='../../../assets/jquery-1.11.2.min.js' charset='utf-8'></script>
<script type='text/javascript' src='../../../assets/echarts.min.js' charset='utf-8'></script>
<script type='text/javascript' src='../../../js/common.js' charset='utf-8'></script>
<script type='text/javascript' src='../../../js/component.js' charset='utf-8'></script>
<script type='text/javascript' src='../../../assets/jquery.swipebox.min.js' charset='utf-8'></script>
<script>
    let loading;
    var vuePage = new Vue({
        el: '#page-elesafe',
        data: {
            imageUrl: '',
            formLabelWidth: '120px',
            currentPage: 1,
            tabData: [],
            dialogFormVisible: false,
            detailFormVisible: false,
            assessFormVisible: false,
            assessedFormVisible: false,
            form: {},
            formExport: {},
            headers: {
                uid: '',
                token: '',
            },
            uploadData: {},
            param: {
                pagesize: 10,
                pageno: 1,
                wf_processflag: '',
                wf_objType: '',
                wf_businesstype: '',
                wf_projectNo: '',
            },
            totalCount: 0,
            tooltip: false,
            day: '',
            Assess: {
                Id: '',
                assess: '',
                assessFlag: '',
                wf_tasktime: ''
            },
            Assessed: {
                assess: '',
                assessFlag: '',
                assessTime: ''
            },
            checkDatalist: {},
            checkpagesize: 10,
            checkpageno: 1,
            checktotalCount: 0,
            wf_tasktime: '',
            wf_Id: '',
            dialogcheckdataVisible: false,
            orginData:[],
        },
        methods: {
            exportDoc: function () {
                if (!this.formExport) {
                    this.$message({type: 'error', message: '数据不能为空'});
                    return;
                }
                var pram = {
                    wf_eventName: this.formExport.wf_eventName,
                    wf_objType: this.formExport.wf_objType,
                    fromName: this.formExport.fromName,
                    toName: this.formExport.toName,
                    wf_eventMsg: this.formExport.wf_eventMsg,
                    wf_reason: this.formExport.wf_reason,
                    wf_processmsg: this.formExport.wf_processmsg,
                    handImg: this.formExport.handImg,
                    image1: this.formExport.image1,
                    img: this.formExport.img,
                };

                HttpUtil.get('WorkFlow/getdetailExportWorkFlow', pram).success((res) => {
                    this.$message.success('导出成功');
                    window.location = SiteConfig.webApiset + res.data;
                })
            },
            onCheckChangePage(page) {
                this.checkpageno = page;
                this.checkdata(this.wf_Id, this.wf_tasktime);
            },
            checkdata(Id, wf_tasktime) {

                if (!Id) {
                    this.$message({type: 'error', message: 'ID不能为空'});
                    return;
                } else {
                    this.wf_Id = Id;
                }

                if (!wf_tasktime) {
                    this.$message({type: 'error', message: '时间不能为空'});
                    return;
                } else {
                    this.wf_tasktime = wf_tasktime;
                }

                var param = {};
                param.pageno = this.checkpageno;
                param.pagesize = this.checkpagesize;
                // d6da8ca9ace4449dbb6795af03937154
                // SiteConfig.account.projectNo
                // param.projectNo = SiteConfig.account.projectNo;
                param.wf_tasktime = this.wf_tasktime.substr(0, 10);
                param.workflowid = this.wf_Id;
                HttpUtil.get('Workflowdataturn/List', param).success((res) => {
                    vuePage.checkDatalist = res.data;
                    vuePage.checktotalCount = res.total;
                    this.dialogcheckdataVisible = true;
                });
            },
            exportData() {
                // var date = this.day.split("-");
                // SiteConfig.account.projectNo
                const d = new Date(this.day);
                var year = d.getFullYear();
                var month = d.getMonth() + 1;

                var param = {
                    // SiteConfig.account.projectNo
                    wf_projectNo: SiteConfig.account.projectNo,
                    webApiset: SiteConfig.webApiset,
                    UserId: SiteConfig.account.id,
                    year: year,
                    month: month
                };
                HttpUtil.get('WorkFlow/ExportWorkFlow', param).success((res) => {
                    this.$message.success('导出成功');
                    window.location = SiteConfig.webApiset + res.data;
                })
            },
            openAssessed: function (row) {
                this.assessedFormVisible = true;
                this.Assessed.assess = row.assess;
                this.Assessed.assessFlag = row.assessFlag;
                this.Assessed.assessTime = row.assessTime;
            },
            openAssess: function (id, wf_tasktime, wf_processflag) {
                if (wf_processflag != 2) {
                    vuePage.$message.error('未完成不可验收!');
                    return;
                }

                this.assessFormVisible = true;
                this.Assess.Id = id;
                this.Assess.wf_tasktime = wf_tasktime;
            },
            insertAssess: function () {
                HttpUtil.get('WorkFlow/assess', this.Assess).success((r) => {
                    if (r.state == 0) {
                        vuePage.$message({
                            type: 'success',
                            message: '验收成功!'
                        });
                        this.assessFormVisible = false;
                        vuePage.getWorkFlow();
                    } else {
                        vuePage.$message.error('验收失败!');
                    }
                })
            },
            urgent: function (id, wf_tasktime, urgentCount) {
                if (urgentCount >= 3) {
                    this.$message({type: 'success', message: '催办次数最多3次！'})
                    return;
                }

                HttpUtil.get('WorkFlow/urgent', {
                    Id: id,
                    wf_tasktime: wf_tasktime,
                    urgentCount: urgentCount
                }).success((r) => {
                    if (r.state == 0) {
                        this.$message({type: 'success', message: '催办成功！'})
                        vuePage.getWorkFlow();
                    } else {
                        this.$message({type: 'error', message: '催办失败！'})
                    }
                })
            },
            effective: function (id, effectiveFlag, wf_tasktime, wf_processflag) {
                if (wf_processflag == 2) {
                    this.$message({type: 'error', message: '派单已处理不可再操作'})
                    return;
                }

                HttpUtil.get('WorkFlow/effective', {
                    Id: id,
                    effectiveFlag: effectiveFlag,
                    wf_tasktime: wf_tasktime
                }).success((r) => {
                    if (r.state == 0) {
                        this.$message({type: 'success', message: '修改成功！'})
                        vuePage.getWorkFlow();
                    } else {
                        this.$message({type: 'error', message: '修改失败！'})
                    }
                })
            },
            userNode: function (data) {
                if (data.id.indexOf('P') == -1) {
                    return;
                }
                this.param.wf_projectNo = data.attributes.projectNo;
                this.getWorkFlow();
            },
            seoBtn: function () {
                this.getWorkFlow();
            },
            aa: function (data) {
            },
            addBtn: function () {
                this.dialogFormVisible = true;
            },
            cancelClick() {
                this.dialogFormVisible = false;
            },
            cancelDetail() {
                this.detailFormVisible = false;
                this.form = {};
            },
            submitClick(formName) {
                this.uploadData.wf_processmsg = this.form.wf_processmsg;
                this.uploadData.wf_reason = this.form.wf_reason;
                this.uploadData.wf_to = this.form.wf_to;
                this.uploadData.wf_objType = this.form.wf_objType;
                this.uploadData.wf_objid = this.form.wf_objid;
                if (this.$refs.upload.fileList.length == 0) {
                    this.$message({
                        type: 'info',
                        message: '必须选择图片'
                    });
                    return;
                }
                this.$refs.upload.submit();
                this.$refs.upload.clearFiles();
            },
            handleClick(row) {
                this.dialogFormVisible = true;
                this.form = row;
            },
            onChangePage(page) {
                this.param.pageno = page;
                this.getWorkFlow();
            },
            getWorkFlow() {
                const d = new Date(this.day);
                this.param.year = d.getFullYear();
                this.param.month = d.getMonth() + 1;
                this.param.wf_projectNo = SiteConfig.account.projectNo;
                HttpUtil.getV2('WorkFlow/List', this.param).success((r) => {
                    this.orginData = r.data;
                    for (let i in r.data){
                        if (r.data[i].handImg!=null) {
                            if(r.data[i].handImg.indexOf('http')!=-1){

                            }else{
                                r.data[i].handImg = this.imageUrl + r.data[i].handImg
                            }
                        }
                        if (r.data[i].image1!=null) {
                            if(r.data[i].image1.indexOf('http')!=-1){

                            }else{
                                r.data[i].image1 = this.imageUrl + r.data[i].image1
                            }
                        }
                        if (r.data[i].img!=null) {
                            if(r.data[i].img.indexOf('http')!=-1){

                            }else{
                                r.data[i].img = this.imageUrl + r.data[i].img
                            }
                        }
                    }
                    this.totalCount = r.total;
                    this.tabData = r.data;
                })
            },
            showDetail(index,row) {
                this.detailFormVisible = true;
                this.form = {
                    wf_eventName: row.wf_eventName,
                    wf_objType: row.wf_objType,
                    fromName: row.fromName,
                    toName: row.toName,
                    wf_eventMsg: row.wf_eventMsg,
                    wf_processmsg: row.wf_processmsg,
                    wf_reason: row.wf_reason,
                    img: row.img,
                    handImg: row.handImg,
                    image1: row.image1,
                    assess: row.assess,
                    assessFlag: row.assessFlag,
                    assessTime: row.assessTime,
                }
                let img = '';
                let handImg = '';
                let image1 = '';
                if (row.img.indexOf(this.imageUrl)!= -1){

                    img = row.img.split('http://iot.hzcando.com:10004')[1]
                } else{
                    img = row.img
                }
                if (row.image1.indexOf(this.imageUrl)!= -1){

                    image1 = row.image1.split('http://iot.hzcando.com:10004')[1]
                } else{
                    image1 = row.image1
                }
                if (row.handImg.indexOf(this.imageUrl)!= -1){

                    handImg = row.handImg.split('http://iot.hzcando.com:10004')[1]
                } else{
                    handImg = row.handImg
                }
                this.formExport = {
                    wf_eventName: row.wf_eventName,
                    wf_objType: row.wf_objType,
                    fromName: row.fromName,
                    toName: row.toName,
                    wf_eventMsg: row.wf_eventMsg,
                    wf_processmsg: row.wf_processmsg,
                    wf_reason: row.wf_reason,
                    img: img,
                    handImg: handImg,
                    image1: image1,
                    assess: row.assess,
                    assessFlag: row.assessFlag,
                    assessTime: row.assessTime,
                }
            }
        },
        created: function () {

        },
        mounted: function () {
            this.imageUrl = SiteConfig.webApiset;
            this.headers = {
                uid: SiteConfig.account.uId,
                token: SiteConfig.account.accessToken
            };
            this.day = TimeUtil.convertToString(new Date()).substr(0, 7);
            this.getWorkFlow();
            this.tooltip = true;
        },
    });
</script>

</body>
</html>

